package com.qfedu.mtl.util.handler.impl;

import com.qfedu.mtl.util.handler.ResultSetHandler;

import java.sql.ResultSet;
import java.sql.SQLException;

public class NumberHandler<T> implements ResultSetHandler<T> {
    private Class<T> cls;
    public NumberHandler( Class<T> cls    ) {
      this.cls =  cls;
    }
    @Override
    public T mapperTo(ResultSet rs) {
        try {
            if(  rs.next()   ){
                Object value = rs.getObject(1);
                return  (T)value;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
